import requestProxy from '@/utils/request';

const { request } = requestProxy;

export function getProduct(data) {
  data.tabId = -7;
  return request({
    url: '/admin/report/file/-7/data',
    method: 'post',
    data
  });
}
export function getOrder(data) {
  data.tabId = -6;
  return request({
    url: '/admin/report/file/-6/data',
    method: 'post',
    data
  });
}

// 订单列表v2.7
export function getOrderList(params, cancelToken) {
  return request({
    url: 'admin/commerce/list',
    method: 'get',
    params,
    cancelToken
  });
}

// 订单列表-统计数据
export function getCommerceStatistics(params, cancelToken) {
  return request({
    url: 'admin/commerce/list/statistics',
    method: 'get',
    params,
    cancelToken
  });
}

// 导入记录列表
export function getImportLog(params) {
  return request({
    url: 'admin/commerce/price/log',
    method: 'get',
    params
  });
}

// 电商管理-商品列表-供货价列表
export function getPriceList(params) {
  return request({
    url: 'admin/commerce/price/list',
    method: 'get',
    params
  });
}

export function postReUpload(data) {
  return request({
    url: 'admin/commerce/upload/cover',
    method: 'post',
    data
  });
}

// v2.7商品列表（动态供货价）
export function getProductList(params, cancelToken) {
  return request({
    url: '/admin/commerce/goodsList',
    method: 'get',
    params,
    cancelToken
  });
}

// 供应商列表
export function getSupplierList(params) {
  return request({
    url: 'admin/commerce/supplier/list',
    method: 'get',
    params
  });
}

// 供应商列表删除
export function supplierDel(id) {
  return request({
    url: `admin/commerce/del/${id}`,
    method: 'delete'
  });
}

// 供应商列表新建
export function supplierAdd(data) {
  return request({
    url: 'admin/commerce/create',
    method: 'post',
    data
  });
}

// 供应商列表编辑
export function supplierEdit(id, data) {
  return request({
    url: `admin/commerce/edit/${id}`,
    method: 'put',
    data
  });
}

// 供应商列表详情
export function supplierInfo(id) {
  return request({
    url: `admin/commerce/info/${id}`,
    method: 'get'
  });
}

// 商品信息变更
export function goodsInfoEdit(data) {
  return request({
    url: 'admin/commerce/goods/edit',
    method: 'put',
    data
  });
}

// 电商管理-商品列表-商品变更记录列表
export function getGoodsLogs(params) {
  return request({
    url: 'admin/commerce/goods/changeLog',
    method: 'get',
    params
  });
}

// 电商管理-订单列表-订单状态
export function getGoodsOrderStatus(params) {
  return request({
    url: 'admin/commerce/goodsOrder/status',
    method: 'get',
    params
  });
}

// 电商-商品管理-批量设置激活/无效商品状态
export function goodsStatusEdit(data) {
  return request({
    url: 'admin/commerce/productManage/status',
    method: 'put',
    data
  });
}

// 电商-商品订单-批量设置确认商品
export function goodsConfirm(data) {
  return request({
    url: 'admin/commerce/productOrder/goodsConfirm',
    method: 'put',
    data
  });
}
// 电商-商品订单-关联商品列表
export function getGoodsOrderAssociatedGoodsList(params) {
  return request({
    url: 'admin/commerce/goodsOrder/associatedGoodsList',
    method: 'get',
    params
  });
}
// 有赞商品规格编码列表
export function getSpecificationCodeList(params) {
  return request({
    url: 'admin/commerce/specificationCode/list',
    method: 'get',
    params
  });
}
export function checkReport(data) {
  return request({
    url: 'admin/commerce/goodsOrder/check',
    method: 'post',
    data,
    headers: { 'Content-Type': 'multipart/form-data' }
  });
}
export function submitReport(data) {
  return request({
    url: 'admin/commerce/goodsOrder/submit',
    method: 'post',
    data
  });
}
export function getUploadLog(params) {
  return request({
    url: 'admin/commerce/goodsOrder/log',
    method: 'get',
    params
  });
}
// 有赞订单自动关联
export function autoAssociation(params) {
  return request({
    url: 'admin/commerce/autoAssociation',
    method: 'get',
    params
  });
}
